<script type="text/javascript">
	function del() {
		if (confirm('确定要删除吗?')) {
			sendAjax("{:U('mark?action=del')}", 'id=' + $("#id").val(), function(data) {
				if (data.status) {
					alert(data.info);
					window.open($("#next_link").attr("href"), '_self');
				}
			});
		}
	}

	function mark_spam() {
		sendAjax("{:U('mark?action=spam')}", 'mail_id=' + $("#id").val(), function(data) {
			if (data.status) {
				alert(data.info);
			}
		});
	}

	function del_forever() {
		sendAjax("{:U('mark?action=del_forever')}", 'mail_id=' + $("#id").val(), function(data) {
			if (data.status) {
				alert(data.info);
			}
		});
	}

	function forword() {
		if ($("input[name='mail_id']:checkbox:checked").length == 1) {
			window.open(fix_url("{:U('reply')}?id=" + $("input[name='mail_id']:checkbox:checked:first").val()) + "&type=forward", "_self");
		} else {
			alert("请选择一封要转发的邮件");
		};
	}

	function mark(val) {
		if (val == "readed") {
			sendAjax("{:U('mark?action=readed')}", 'main_id=' + $("#id").val());
		} else {
			sendAjax("{:U('mark?action=unread')}", 'main_id=' + $("#id").val());
		}
	}

	function move_to(val) {
		sendAjax("{:U('mark?action=move_folder')}", 'val=' + val + '&mail_id=' + $("#id").val(), function(data) {
			alert(data.info);
		})
	}

	function reply(type) {
		if (type == "reply") {
			setTimeout(function() {
				window.location.href = fix_url("{:U('reply?id='.$vo['id'])}?type=" + type);
			}, 300);
		} else {
			window.location.href = fix_url("{:U('reply?id='.$vo['id'])}?type=" + type);
		}
	}

	function myprint() {
		window.print();
	}


	$(document).ready(function() {
		$("#move_to li").click(function() {
			move_to($(this).attr("id"));
		})
		show_content();
	})
</script>